<?php
class Default_Form_EditProfile extends Zend_Form
{
    public function init()
    {
        $this->setMethod('post');

        $user = new Default_Model_User();

        $definition = $user->getTable()->getColumnDefinition('first_name');
        $this->addElement('text', 'first_name', array(
            'label'      => 'First name',
            'required'   => true,
            'filters'    => array('StringTrim'),
            'validators' => array(
                array('validator' => 'StringLength',
                      'options' => array(0, $definition['length']))
            )
        ));

        $definition = $user->getTable()->getColumnDefinition('last_name');
        $this->addElement('text', 'last_name', array(
            'label'      => 'Last name',
            'required'   => true,
            'filters'    => array('StringTrim'),
            'validators' => array(
                array('validator' => 'StringLength',
                      'options' => array(0, $definition['length']))
            )
        ));

        $this->addElement('submit', 'submit', array(
            'label'    => 'Save',
        ));
    }
}

